Merge branch 'master' of ssh://xp-dev.com/RRRRHHHH_Code
[RRRRHHHH_Code] / ruralHouses client / src / gui / listOfOwnerAddittionRequests.java
index 9e1b6a3..b3297b4 100644 (file)
@@ -94,8 +94,6 @@ public class listOfOwnerAddittionRequests extends JFrame {
                tableModel = new DefaultTableModel(null, new String[] {
                                "Name", "E-mail", "Bank Account" });
                
-               //Maybe there is a better way to avoid interaction.
-               //table.setEnabled(false);
                table.setModel(tableModel);
                
                JButton btnNewButton = new JButton("Confirm Addition");
@@ -106,23 +104,22 @@ public class listOfOwnerAddittionRequests extends JFrame {
                                        
                                        try {
                                                acm = (AccountInterface) Naming
-                                                               .lookup(___IntNames.AdminManager);
+                                                               .lookup(___IntNames.AccountManager);
                                        } catch (Exception e1) {
                                                System.out.println("Error accessing remote authentication: "
                                                                + e1.toString());
                                        }
-                                       Account accou = accounts.get(table.getSelectedRow());
+
                                        try {
-                                               acm.addAccount(accou);
-                                               am.removeOwnerAdditionRequests(accou);
+                                               acm.addAccount(table.getSelectedRow());
+                                               am.removeOwnerAdditionRequests(table.getSelectedRow());
                                                am.saveInstance();
                                        } catch (RemoteException e1) {
-                                               // TODO Auto-generated catch block
                                                e1.printStackTrace();
                                        }
-                       
-                                       ((DefaultTableModel)table.getModel()).removeRow(accounts.indexOf(accou));
-                                       accounts.remove(accou);
+                                       
+                                       ((DefaultTableModel)table.getModel()).removeRow(table.getSelectedRow());
+                                       
                                }
                        }
                });
@@ -133,17 +130,14 @@ public class listOfOwnerAddittionRequests extends JFrame {
                btnDenyAddition.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent arg0) {
                                if (table.getRowCount()!=0 && table.getSelectedRow() != -1) {
-                                       Account acc = accounts.get(table.getSelectedRow());
                                        try {
-                                               am.removeOwnerAdditionRequests(acc);
+                                               am.removeOwnerAdditionRequests(table.getSelectedRow());
                                                am.saveInstance();
                                        } catch (RemoteException e) {
-                                               // TODO Auto-generated catch block
                                                e.printStackTrace();
                                        }
                                        
-                                       ((DefaultTableModel)table.getModel()).removeRow(accounts.indexOf(acc));
-                                       accounts.remove(acc);
+                                       ((DefaultTableModel)table.getModel()).removeRow(table.getSelectedRow());
                                }
                        }
                });